#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPen>
#include <QTableWidget>

struct Pair
{
    double maxRes;
    double maxResOp;
    double euclRes;
    Pair (double x=0, double y=0, double z=0): maxRes(x), maxResOp(y),euclRes(z) {}
};

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    bool event(QEvent *mEvent);
    QTableWidget* table, *splineTable;

    void createSpline (QVector<double>& x, QVector<double>& f, int n, double S0, double Sn);
    Pair computeNext(double**x0, double** x1, double**f, int n, int m, int type);

    double maxFourthDerivative (double** f, int n, int m, double &xDer, double& yDer, int multiplier=-1);

    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:

    void on_pushButton_3_clicked();
    void updateEstimate();

    void on_pushButton_4_clicked();
    void changeMagicBehavior();


private:
    Ui::MainWindow *ui;
    bool isMagic;
};

#endif // MAINWINDOW_H
